<?php if ($type != Users::TYPE_ADMIN): ?>
    <form method="GET">
        <?php
        if ($this->isAdmin)
        {
            if ($type == Users::TYPE_STAFF OR $type == Users::TYPE_CUSTOMER)
            {
                $bizTitle = array('0' => 'Select Merchant');
                $bizArray = $bizTitle + Users::getAllBussiness(TRUE);
                echo CHtml::dropDownList('business', $this->filterBusiness, $bizArray, array(
                    'onchange' => 'this.form.submit();',
                    'data-rel' => 'chosen'
                ));
            }
        }
        else if ($this->isBussiness)
        {
            if ($type == Users::TYPE_STAFF OR $type == Users::TYPE_CUSTOMER)
            {
                if (!$this->isBranch)
                {
                    $bizTitle = array('0' => 'Select Branch');
                    $bizArray = $bizTitle + Users::getAllBussiness(FALSE, Yii::app()->user->id, TRUE);
                    echo CHtml::dropDownList('business', $this->filterBusiness, $bizArray, array(
                        'onchange' => 'this.form.submit();',
                        'data-rel' => 'chosen'
                    ));
                }
                else
                {
                    $user     = Yii::app()->user->getCurrentUser();
                    $bizTitle = array('0' => 'Select Merchant');
                    $bizArray = $bizTitle + Users::getAllBussiness(FALSE, $user->author->id, TRUE);
                    echo CHtml::dropDownList('business', $this->filterBusiness, $bizArray, array(
                        'onchange' => 'this.form.submit();'
                    ));
                    unset($user);
                }
            }
        }
        ?>                
        <?php if ($this->search == FALSE): ?>
            <input  type="text" placeholder= "<?php echo $type ? 'Merchant' : $type ?> you want to search" name="key" 
                    value="<?php echo isset($_GET['key']) ? $_GET['key'] : '' ?>">
            <input id="search" class="btn btn-success" type="submit" value="search">
        <?php else : ?>
            <input type="text" placeholder="Customers you want to search" name="key" 
                   value="<?php echo isset($_GET['key']) ? $_GET['key'] : '' ?>">
            <input id="search" class="btn btn-success" type="submit" value="search">
        <?php endif; ?>
    </form>
<?php endif; ?>